﻿<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>医院药品管理系统</title>

  <link type="text/css" th:href="@{/static/layui/css/style.css}" rel="stylesheet" />
  <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
  <link rel="stylesheet" th:href="@{/static/admin/style.css}" media="all">
</head>
<body>
<div class="container">
  <form class="layui-form">
    <div>
      <br/>
      <p>欢迎光临</p>
    </div>
    <div >
      <input type="text" name="username" placeholder="用户名"  autocomplete="off">
    </div>
    <div >
      <input type="password" name="password"  placeholder="密码"  autocomplete="off">
    </div>
    <div class="layui-input-inline login-btn">
      <button lay-submit lay-filter="login" class="layui-btn layui-btn-radius">登录</button>
      <button lay-submit lay-filter="zc" class="layui-btn layui-btn-normal layui-btn-radius">注册</button>
    </div>
    <br/>
    <br/>
    <br/>
    <a href="#">忘记密码?</a>
  </form>

  <div class="drops">
    <div class="drop drop-1"></div>
    <div class="drop drop-2"></div>
    <div class="drop drop-3"></div>
    <div class="drop drop-4"></div>
    <div class="drop drop-5"></div>
  </div>

</div>
<script th:src="@{/static/layui/layui.js}"></script>
<script>
  layui.use("form",function () {
    var form = layui.form;//获取到 layui的别名
    var $ = layui.$;
    //监听提交的按钮
    form.on("submit(login)",function (data) { //把数据传入data里面
      $.ajax({
        url:"/toLogin", //跳转页面
        type:"POST",  //数据请求
        data:data.field,  //要传输的数据
        dataType:"json",  //数据JSON格式
        //调用成功的话，返回result数据
        success: function (result) {
          if(result.code == "1"){ //如果result
            layer.msg(result.msg,{icon:result.icon,anim:result.anim},function () {
              location.href = "/index";    //登录成功，转向后台主页
            });
          }else{
            layer.msg(result.msg,{icon:result.icon,anim:result.anim});
          }
        }
      });
      return false;//返回值
    });
  });
</script>
</body>
</html>
















